package com.mew.chess.core.game.bjl.game.task;

import com.mew.chess.core.common.handler.ChessPushMessageUtil;
import com.mew.chess.core.game.bjl.game.BjlGameManager;
import com.mew.chess.core.game.bjl.game.BjlRoomManager;
import com.mew.chess.core.game.bjl.game.common.BjlConstantValue;
import com.mew.chess.core.game.bjl.game.common.BjlLinkType;
import com.mew.chess.core.game.bjl.game.common.BjlPushCMDMapType;
import com.mew.chess.core.game.bjl.game.message.PushStartBetMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 压注阶段
 * @author dylin
 * @create 2021/4/22
 */
@Component
@Slf4j
public class BjlStartBetTask {
    public void startBet(int roomId){
        BjlRoomManager roomManager = BjlGameManager.getInstance().getController(roomId);
        //------start game-----
        roomManager.changeLink(BjlLinkType.StartBet.code(),BjlConstantValue.START_BET_TIME);
        PushStartBetMessage pushStartBetMessage=roomManager.getPushStartBetMessage();
        ChessPushMessageUtil.broadcastMessage(roomManager.getOnlineUser().values(),BjlPushCMDMapType.StartBetMessage.code(), pushStartBetMessage
                );
    }
}
